<?php

namespace Admin\Model;
use Think\Model;

class MyMemberAddrModel extends Model
{
	/**
	 * [myuserlist description]
	 * @return [array] [返回用户查询或列表数据]
	 */
	public function myaddrlist(){

		if(!empty($_GET['title'])){
			$var=I('get.title');
			if(is_numeric($var)){
				$map['phone']=['eq',$var];
			}else{
				$map['receiver']=['eq',$var];
			}
			$list=$this->where($map)->select();
		}else if(!empty($_GET['user_id'])){
			$user_id=I('get.user_id');
			$map['user_id']=['eq',$user_id];
			$list=$this->where($map)->select();
		}else{
			//不是查询操作，则展示所有用户
			$list=$this->select();
		}
		return $list;
	}

	// 按照条件进行排序
	public function mysort(){

		if (!empty(I('get.'))) {
				$action=I('get.action');
				$num=I('get.num');
				if($action=='addr_id'){
						if ($num==1) {
							$map='addr_id desc';
						}else{
							$map='addr_id asc';
						}
				}
				$list=$this->order($map)->select();
			}else{
				$list=$this->select();
			}
		return $list;
	}


}
